package com.maozzi.website.web.controller.rest;

import brave.Tracer;
import com.maozzi.common.model.ResultVO;
import com.maozzi.website.web.feign.UserService;
import com.maozzi.website.web.model.AclUserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 管理员 controller
 *
 * @author maozi
 */
@Slf4j
@RestController
@RequestMapping("/rest/admin")
public class AdminController {
    @Resource
    private UserService userService;
    @Resource
    private Tracer tracer;

    /**
     * 通过 feign 调用 passport 接口
     *
     * @param userId 参数
     * @return 返回
     */
    @GetMapping("/getAclUser.json")
    public ResultVO<AclUserVO> getAclUser(Long userId) {
        log.info("website ------- getAclUser method, traceId={},spanId={}",
                tracer.currentSpan().context().traceIdString(),
                tracer.currentSpan().context().spanIdString());
        return userService.getAclUser(userId);
    }

}
